<template>
	<view class="detailCont">
		<van-nav-bar fixed title="客户详情" left-text="返回" left-arrow @click-left="goBack()">
			<template #right>
				<van-icon name="edit" size="18" @click="toEditView" />
			</template>
		</van-nav-bar>

		<view class="main_box">
			<van-cell-group>
				<van-cell title="有效状态">
					<template #default>
						<view class="">
							<text>{{detail.active_status}}</text>
							<text class="lookup" @click="allocateFn">自动分配</text>
						</view>
					</template>
				</van-cell>
				<van-cell title="客资来源">
					<template #default>
						<view>
							<text class="mobile">{{detail.source_text}}</text>
							<text class="lookup" @click="channelsFn">重复渠道</text>
						</view>
					</template>
				</van-cell>
				<van-cell title="联系方式">
					<template #default>
						<view>
							<text class="mobile">{{detail.mobile}}</text>
							<text class="lookup" @click="lookup">查看</text>
						</view>
					</template>
				</van-cell>
				<!-- 			<van-cell title="">
				    <template #default>
				        <view>
				            <text class="lookup pd10" @click="createCode">生成</text>
				            <text class="lookup pd10" @click="copyCode">复制</text>
				        </view>
				    </template>
				</van-cell> -->
				<van-cell title="微信" v-if="detail.wechat1">
					<template #default>
						<view>
							<text class="mobile">{{detail.wechat1}}</text>
							<text class="lookup" @click="wechat('wechat1')">查看</text>
						</view>
					</template>
				</van-cell>
				<van-cell title="微信" v-if="detail.wechat2">
					<template #default>
						<view>
							<text class="mobile">{{detail.wechat2}}</text>
							<text class="lookup" @click="wechat('wechat2')">查看</text>
						</view>
					</template>
				</van-cell>
				<van-cell title="添加微信状态">
					<template #default>
						<view v-if="weChatStatus==2">
							<uni-tag text="微信号今日已加过" type="success" />
						</view>
						<view v-else-if="weChatStatus==3">
							<uni-tag text="微信未申请" type="warning" />
						</view>
						<view v-else>
							<uni-tag text="微信已通过" type="success" />
						</view>

					</template>
				</van-cell>
			</van-cell-group>

		</view>

		<van-tabs v-model="tabActive" 　@click="detaliListFn">
			<van-tab title="客户资料" name="basic-list">
				<uni-section title="基本信息" type="line" class="mb12">
					<view class="sdsdf">
						<view class="info">
							<view class="con">
								<text class="txt1">客户姓名</text>
								<text class="txt2">{{detail.realname}}</text>
							</view>
							<view class="con">
								<text class="txt1">电话</text>
								<text class="txt2">{{detail.mobile}}</text>
							</view>
							<view class="con">
								<text class="txt1">婚期</text>
								<text class="txt2">{{detail.wedding_date}}</text>
							</view>
							<view class="con">
								<text class="txt1">预算</text>
								<text class="txt2">{{detail.budget + '-' + detail.budget_end}}</text>
							</view>
							<view class="con">
								<text class="txt1">桌数</text>
								<text class="txt2">{{detail.banquet_size + '-' + detail.banquet_size_end}}</text>
							</view>
							<view class="con">
								<text class="txt1">咨询区域</text>
								<text class="txt2">{{detail.zone}}</text>
							</view>
							<view class="con">
								<text class="txt1">咨询酒店</text>
								<text class="txt2">{{detail.hotel_text}}</text>
							</view>
							<view class="con">
								<text class="txt1">备注</text>
								<text class="txt2">{{detail.remark}}</text>
							</view>
							<view class="con" style="width: 100%;">
								<text class="txt1 wtxt">下次回访时间</text>
								<text class="txt2 wtxt2">{{detail.next_visit_time}}</text>
							</view>
						</view>
					</view>
				</uni-section>
				<uni-section title="来源渠道" type="line" class="mb12">
					<view class="sdsdf">
						<view class="info">
							<view class="con">
								<text class="txt1">来源</text>
								<text class="txt2">{{detail.source_text}}</text>
							</view>
						</view>
					</view>
				</uni-section>
				<uni-section title="重复渠道" type="line" class="mb12" v-if="sourceDuplicateList.length>0">
					<view>
						<view class="table_box table_hd">
							<view class="row_th">
								添加人
							</view>
							<view class="row_th">
								平台
							</view>
							<view class="row_th">
								城市
							</view>
							<view class="row_th">
								账号
							</view>
							<view class="row_th">
								添加时间
							</view>
						</view>
						<view class="table_box" v-for="(item,index) in sourceDuplicateList" :key="index">
							<view class="row-td">{{item.user.realname}}</view>
							<view class="row-td">{{item.source.title}}</view>
							<view class="row-td">{{item.city}}</view>
							<view class="row-td">{{item.account.title}}</view>
							<view class="row-td">{{item.create_time}}</view>
						</view>
					</view>
				</uni-section>
			</van-tab>
			<van-tab title="回访记录" name="visit-list">
				<van-cell-group class="mb12" v-for="(item, index) in recordData" :key="index">
					<van-cell :value="item.create_time">
						<template #title>
							<span class="custom-title">回访时间</span>
							<van-tag :type="item.status == '有效客户' ? 'danger' : 'primary'">{{ item.status }}</van-tag>
						</template>
					</van-cell>
					<van-cell title="回访内容" :label="item.content" :value="'跟进人: ' + item.realname" />
				</van-cell-group>

				<van-empty v-if="recordData.length == 0" description="暂无回访记录" />
			</van-tab>
			<van-tab title="进店记录" name="into-store-list">
				<van-cell-group class="mb12" v-for="(item, index) in shopData" :key="index">
					<van-cell :value="item.subscribe_time" is-link @click="gotoShop(item.id)">
						<template #title>
							<span class="custom-title">预约进店时间</span>
							<van-tag type="danger">{{ item.status }}</van-tag>
						</template>
					</van-cell>
					<van-cell v-if="item.real_time" title="实际进店时间" :value="item.real_time" />
					<van-cell v-if="item.next_time" title="下次回访时间" :value="item.next_time" />
					<van-cell title="备注" :label="item.remark" />
				</van-cell-group>
				<van-empty v-if="shopData.length == 0" description="暂无进店记录" />
			</van-tab>
			<van-tab title="云客通话记录" name="yun-list">
				<view class="steps">
					<view class="step-item" v-for="(item, index) in PhoneRecord" :key="index">
						<view class="step-left">
							<view>{{item.create_time}}</view>
							<view>{{item.realname}}</view>
						</view>
						<view class="step-content">
							<view class="step-dot"></view>
							<!-- 			 	          <view class="step-title">dd</view> -->
							<view class="step-desc">
								<view class="record-divst" v-if="item.timeline_type=='CALL'">
									<view class="record-header">进行电话沟通</view>
									<view class="record-div" v-if="item.duration!=0">
										<view class="record-title"
											v-if="item.record_url.slice(0,23)==='http://yunke-pcfile.oss'">
											<view @click="recordFn(item.record_url.replace('http://', 'https://'))"
												class="lookup">录音</view>
										</view>
										<view class="record-title" v-else>录音:
											<uni-icons class="uniui-sound" @click="toggleVideo(index,item.record_url)"
												type="sound-filled" size="30"></uni-icons>
											{{ currentStatus(index) }}
										</view>
									</view>
									<view class="record-div" v-if="item.duration">
										<view class="record-title">通话时长:{{item.duration}}</view>
									</view>
									<view class="record-div" v-if="item.tip_name">
										<view class="record-title">小标签:{{item.tip_name}}</view>
									</view>
								</view>
								<view class="record-divst" v-if="item.timeline_type=='REMARK'">
									<view class="" v-if="item.remark_type ==1">
										<view class="record-header">添加客户备注语音</view>
										<view class="record-div" v-if="item.duration!=0">
											<view class="record-title">录音:
												<uni-icons class="uniui-sound"
													@click="toggleVideo(index,item.record_url)" type="sound-filled"
													size="30"></uni-icons>
												{{ currentStatus(index) }}
											</view>

										</view>
										<view class="record-div" v-if="item.duration">
											<view class="record-title">通话时长:{{item.duration}}</view>
										</view>
									</view>
									<view class="" v-if="item.remark_type ==0">
										<view class="record-header">添加客户备注</view>
										<view class="record-div" v-if="item.remark">
											<view class="record-title">添加客户备注:{{remark}}</view>
										</view>
									</view>
								</view>
								<view class="record-divst" v-if="item.timeline_type=='MODIFY'">
									<view class="record-header" v-if="item.modify_type=='0'">添加客户</view>
									<view class="record-header" v-if="item.modify_type=='1'">修改客户</view>
									<view class="record-header" v-if="item.modify_type=='2'">删除客户</view>
									<view class="record-header" v-if="item.modify_type=='3'">变更跟进人</view>

									<view class="record-header" v-if="item.modify_type=='4'">添加协作人</view>
									<view class="record-header" v-if="item.modify_type=='13'">添加拜访记录</view>
									<view class="record-header" v-if="item.modify_type=='8'">变更协作人</view>
									<view class="record-header" v-if="item.modify_type=='22'">触发公海规则回收</view>
									<view class="record-div" v-for="(items ,index) in item.content" :key="index">
										{{items}}
									</view>
								</view>
								<view class="record-divst" v-if="item.timeline_type=='SMS'">
									<view class="" v-if="item.type ==0">
										<view class="record-header">微信收消息</view>
										<view class="record-div">
											<view class="record-title" v-if="item.duration!=0">录音:
												<uni-icons class="uniui-sound"
													@click="toggleVideo(index,item.record_url)" type="sound-filled"
													size="30"></uni-icons>
												{{ currentStatus(index) }}
											</view>
										</view>
										<view class="record-div" v-if="item.duration">
											<view class="record-title">通话时长:{{item.duration}}</view>
										</view>
									</view>
									<view class="" v-if="item.type ==1">
										<view class="record-header">微信发消息</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<van-empty v-if="PhoneRecord.length == 0" description="暂无云客通话记录" />
			</van-tab>
		</van-tabs>
		<!-- 底部功能导航 -->
		<van-tabbar v-model="tabbarActive" @change="changeBottomNav">
			<van-tabbar-item icon="comment-o" name="visit">写回访</van-tabbar-item>
			<van-tabbar-item icon="fire" name="into-store">预约到店</van-tabbar-item>
			<van-tabbar-item v-if="is_open_yunke==1" icon="phone-o" name="phone">云客拨打</van-tabbar-item>
			<van-tabbar-item v-else icon="phone-o" name="phone">拨打电话</van-tabbar-item>
			<van-tabbar-item icon="wechat" name="weChat">微信</van-tabbar-item>
			<van-tabbar-item icon="cart-o" name="create-order">申请成单</van-tabbar-item>
		</van-tabbar>

		<!-- 悬浮球 -->
		<sa-hover-menu ref="saHoverMenu" v-if="roleArr.includes(roleId + '')" :btnList="memberBtns"></sa-hover-menu>
		<sa-hover-menu ref="saHoverMenu" v-else :btnList="floatBtns"></sa-hover-menu>
		<wechatNav ref="wechatNav" @checkWeChatStatus="checkWeChatStatus"></wechatNav>
		<enterStore ref="enterStore" @shopRecord='shopRecord'></enterStore>
		<duplicateChannels ref="duplicateChannels" @getData='getData' :sourceDuplicateList="sourceDuplicateList">
		</duplicateChannels>
		<visitAdd ref="visitAdd" @getData='getRecord'></visitAdd>
	</view>
</template>

<script>
	import dingtalk from '@/utils/dingtalk.open.js';
	import saHoverMenu from '../../components/sa-hover-menu/sa-hover-menu.vue';
	import navigation from '@/component/navigation.vue';
	import timeSelector from '@/component/wing-time-selector/wing-time-selector.vue';
	import sun from '@/utils/sun.js';
	import dictionary from '@/utils/dictionary.js';
	import wechatNav from '../customer/ykRecord/wechatNav.vue';
	import enterStore from '../customer/store/enterStore.vue';
	import duplicateChannels from '../customer/components/duplicateChannels.vue';
	import visitAdd from '../customer/components/visitAdd.vue';
	import {
		buildHttpQuery
	} from '@/utils/funs.js';
	const query = {
		source_id: "",
		account_city_id: "",
		account_id: "",
		member_id: ""
	};


	const innerAudioContext = uni.createInnerAudioContext() //想要实现暂停功能就要把该对象变为全局属性
	export default {
		components: {
			saHoverMenu,
			navigation,
			timeSelector,
			wechatNav,
			enterStore,
			duplicateChannels,
			visitAdd
		},
		data() {
			let accountPickerList = dictionary.getPicker('account');
			return {
				mobile: '',
				tabActive: 'basic-list',
				tabbarActive: '',
				showPopover: false,
				query: Object.assign({}, query), // 搜索条件
				actions: [{
						text: '编辑',
						icon: 'edit',
						name: 'edit'
					},
					{
						text: '个人转发',
						icon: 'revoke',
						name: 'share-to-person'
					},
					{
						text: '门店转发',
						icon: 'exchange',
						name: 'share-to-store'
					}
				],
				floatBtns: [],
				isShowOrder: false,
				detail: {}, //客户详情
				recordData: [], //回访记录
				recordPage: 0,
				shopData: [], //进店记录
				shopPage: 0,
				current: 0,
				options: {},
				date: '', //预约时间
				holetData: {
					value: '',
					id: ''
				}, //预约门店
				holetList: [], //酒店列表
				remarkValue: '', //备注
				role: '',
				showToshop: false,
				showCalendar: false, //日历显示
				minDate: new Date(2021, 0, 1), //日历可选择的最小日期
				showFilter: false,
				hotelList: [], //预约门店列表
				filterType: 'hotel',
				roleId: "",
				roleArr: ['1', '2', '3', '4', '7'],
				show: false,
				showTochannels: false,
				sourceList: [],
				accountPickerList: accountPickerList,
				accountSourceList: [],
				cityList: [],
				accountList: [],
				sourceDuplicateList: [],
				region: [{
						id: '802',
						title: '上海'
					},
					{
						id: '1965',
						title: '广州'
					},
					{
						id: '934',
						title: '杭州'
					},
					{
						id: '821',
						title: '南京'
					},
					{
						id: '861',
						title: '苏州'
					},
					{
						id: '948',
						title: '宁波'
					},
					{
						id: '818',
						title: '奉贤'
					}
				],
				is_open_yunke: 0,
				showWechat: false,
				weChatStatus: '',
				is_open_wechat: 0,
				copyContent: "",
				PhoneRecord: [],
				isPlaying: [],
				friend_info: "",
				staffList: [],
				current: 999,
			};
		},
		onLoad(options) {
			let _this = this;
			this.options = options;
			let user = uni.getStorageSync('user')
			_this.roleId = user.role_id
			_this.checkWeChatStatus(options.member_id)
			// #ifdef APP-PLUS
			this.holetData.value = options.hotelFrom;
			this.holetData.id = options.hotelID;
			this.mobile = '';
			// #endif
			let floatBtns = [
				// 所有按钮
				{
					icon: '个',
					text: '个人转发',
					bgcolor: '#FE7A7D',
					click: function() {
						_this.$refs["saHoverMenu"].close();
						uni.navigateTo({
							url: '/pages/customerDetail/distribution/distribution?id=' + _this.options.id
						});
					}
				},
				{
					icon: '内',
					text: '内部门店',
					bgcolor: '#CAB493',
					click: function() {
						_this.$refs["saHoverMenu"].close();
						uni.navigateTo({
							url: `/pages/searchHotel/searchHotel?origin=${'distributionHotel'}&&id=${_this.options.id}`
						});
					}
				}
			];

			let memberBtns = [
				// 所有按钮
				{
					icon: '个',
					text: '个人转发',
					bgcolor: '#FE7A7D',
					click: function() {
						_this.$refs["saHoverMenu"].close();
						uni.navigateTo({
							url: '/pages/customerDetail/distribution/distribution?id=' + _this.options.id
						});
					}
				},
				{
					icon: '内',
					text: '内部门店',
					bgcolor: '#CAB493',
					click: function() {
						_this.$refs["saHoverMenu"].close();
						uni.navigateTo({
							url: `/pages/searchHotel/searchHotel?origin=${'distributionHotel'}&&id=${_this.options.id}`
						});
					}
				},
				{
					icon: '外',
					text: '外部商户',
					bgcolor: '#79ca4f',
					click: function() {
						_this.$refs["saHoverMenu"].close();
						uni.navigateTo({
							url: '/pages/customerDetail/allocate/allocate?member_id=' + _this.options
								.member_id + '&id=' + _this.options.id
						});
					}
				}
			];

			this.floatBtns = floatBtns;
			this.memberBtns = memberBtns;
		},
		onShow() {
			this.show = false;
			this.getData({
				id: this.options.id
			});
			this.getRecord({
				id: this.options.id
			});
			this.shopRecord({
				id: this.options.id
			});

			// #ifdef APP-PLUS
			uni.$on('globleEvent', rel => {
				this.holetData.value = rel.hotelFrom;
				this.holetData.id = rel.hotelID;
			});
			// #endif
		},
		beforeMount() {
			this.dictionary = dictionary;
		},
		computed: {
			currentStatus() {
				return function(index) {
					if (this.isPlaying[index]) {
						return '播放';
					} else {
						return '关闭';
					}
				}
			}
		},
		methods: {
			recordFn(url) {
				window.location.href = url
			},
			//重复渠道
			channelsFn() {
				let _this = this;
				this.$refs['duplicateChannels'].showDuplicateChannelsPop(this.options)

			},
			//云客播放
			toggleVideo(index, url) {
				console.log(index, url)
				const isPlaying = this.isPlaying[index];
				console.log(isPlaying)
				if (isPlaying) {
					console.log(index, url)
					innerAudioContext.src = url;
					innerAudioContext.volume = 1
					innerAudioContext.play();
				} else {
					innerAudioContext.stop()

				}
				this.isPlaying[index] = !isPlaying;
				this.$forceUpdate()
				console.log(this.isPlaying[index])


			},
			//云客电话记录
			detaliListFn(name) {
				//console.log((name))
				if (name == 'yun-list') {
					let _this = this;
					sun.request({
						url: '/api/customer.member/callList',
						token: true,
						data: {
							member_id: _this.options.member_id,
						},
						success(res) {
							if (res.code == 200) {
								let getTableData = res.data.data
								_this.PhoneRecord = getTableData
								// 初始化播放状态数组
								_this.isPlaying = new Array(_this.PhoneRecord.length).fill(true);
							}
						},
						fail(e) {
							uni.showToast({
								icon: 'none',
								title: '服务器开小差去啦~'
							});
						}
					});
				}
			},
			//自动分配
			allocateFn() {
				let _this = this;
				sun.request({
					url: '/api/customer.allocate/auto',
					token: true,
					data: {
						// member_id:_this.detail.id,
						id: _this.options.id //分配id
					},
					success(res) {
						if (res.code == 200) {
							uni.showToast({
								icon: 'none',
								title: res.msg
							});
						} else {
							uni.showToast({
								icon: 'none',
								title: res.msg
							});
						}
					},
					fail(e) {
						uni.showToast({
							icon: 'none',
							title: '服务器开小差去啦~'
						});
					}
				});
			},

			//悬浮层点击
			getShow() {
				let _this = this;
				_this.show = !_this.show;
			},
			// 选择预约时间
			confirmToshopData(date) {
				this.date = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
				this.showCalendar = false;
			},
			//获取备注
			getRemark(row) {
				this.remarkValue = row;
			},
			// 更多中的事件：包含编辑，个人转发，门店转发
			toEditView() {
				uni.navigateTo({
					url: '/pages/customer/edit?id=' + this.options.id
				});
			},
			checkWeChatStatus(member_id) {
				let _this = this;
				let url = '/api/customer.member/checkWeChatStatus';
				let params = {
					member_id: member_id,
				};
				sun.request({
					url: url,
					token: true,
					data: params,
					success(res) {
						if (res.code == 200) {
							_this.weChatStatus = res.data.status
						} else {
							_this.weChatStatus = res.data.status
						}
					},
					fail(e) {
						uni.showToast({
							icon: 'none',
							title: '服务器开小差去啦~'
						});
					}
				});
			},


			// 底部导航
			changeBottomNav(index) {
				let that = this;
				switch (index) {
					case 'visit': // 添加回访记录
						// uni.navigateTo({
						//     url: '/pages/customer/visit/add?id=' + this.options.id
						// });
						this.$refs['visitAdd'].showVisitAddPop(this.options)
						break;
					case 'into-store': // 预约到店
						this.$nextTick(function() {
							// this.$refs.popup.open();
							//  this.showToshop = true;
							this.$refs['enterStore'].showEnterStorePop(this.options)

						});
						break;
					case 'phone': // 电话
						sun.request({
							url: '/h5/customer.customer/mobile',
							showLoading: true,
							token: true,
							data: {
								id: that.options.id,
								type: 1
							},
							success(res) {
								if (res.code == 200) {

									if (that.is_open_yunke == 1) {
										uni.showToast({
											icon: 'none',
											title: res.msg
										});
									} else {
										uni.makePhoneCall({
											phoneNumber: res.data.mobile
										});
									}

								} else {
									uni.showToast({
										icon: 'none',
										title: res.msg
									});
								}
							},
							fail(e) {
								uni.showToast({
									icon: 'none',
									title: '服务器开小差去啦~'
								});
							}
						});

						break;
					case 'weChat': // 微信
						this.$nextTick(function() {
							// this.showWechat = true;
							// this.getWechatInfo()

							this.$refs['wechatNav'].showwechatNavPop(this.detail, this.options, this.friend_info)
						});
						break;
						// 创建订单
					case 'create-order':
						let queryObj = {
							member_allocate_id: this.options.id
						};

						if (!this.detail.id) {
							let detail = this.detail;
							uni.showLoading({
								title: '加载中'
							});

							setTimeout(function() {
								uni.hideLoading();
								if (!detail.id) {
									uni.showToast({
										icon: 'none',
										title: '网络异常'
									});
								} else {
									queryObj['member_id'] = detail.id;
									let queryStr = buildHttpQuery(queryObj);

									uni.navigateTo({
										url: '/pages/order/createOrder/createOrder?' + queryStr
									});
								}
							}, 2000);
						} else {
							queryObj['member_id'] = this.detail.id;
							let queryStr = buildHttpQuery(queryObj);

							uni.navigateTo({
								url: '/pages/order/createOrder/createOrder?' + queryStr
							});
						}
						break;
				}
				this.tabbarActive = '';
			},
			// 查看手机号
			lookup() {
				let that = this;
				sun.request({
					url: '/h5/customer.customer/mobile',
					showLoading: true,
					token: true,
					data: {
						id: that.options.id,
						type: 2
					},
					success(res) {
						if (res.code == 200) {
							that.detail.mobile = res.data.mobile;
						} else {
							uni.showToast({
								icon: 'none',
								title: res.msg
							});
						}
					},
					fail(e) {
						uni.showToast({
							icon: 'none',
							title: '服务器开小差去啦~'
						});
					}
				});
			},
			// 查看微信
			wechat(field) {
				let that = this;
				sun.request({
					url: '/h5/customer.customer/wechat',
					showLoading: true,
					token: true,
					data: {
						id: that.options.id,
						field: field,
						type: 3
					},
					success(res) {
						if (res.code == 200) {
							that.detail[field] = res.data[field];
						} else {
							uni.showToast({
								icon: 'none',
								title: res.msg
							});
						}
					},
					fail(e) {
						uni.showToast({
							icon: 'none',
							title: '服务器开小差去啦~'
						});
					}
				});
			},
			//预约门店
			jumpSearchHotel() {
				this.showFilter = true;
				// let url = '../customerDetail/customerDetail';
				// let origin = 'customer';
				// uni.navigateTo({
				//     url: '../searchHotel/searchHotel?type=detail&&url=' + url + '&&origin=' + origin
				// });
			},

			getData(e) {
				let that = this;
				sun.request({
					url: '/h5/customer.customer/member',
					showLoading: true,
					token: true,
					data: {
						id: e.id
					},
					success(res) {
						if (res.code == 200) {
							that.detail = res.data.customer;
							that.is_open_yunke = res.data.customer.is_open_yunke;
							that.is_open_wechat = res.data.customer.is_open_wechat;
							that.role = res.data.role;
							that.sourceDuplicateList = res.data.sourceDuplicateList;
							if (res.data.friend_info && res.data.friend_info != null) {
								that.friend_info = res.data.friend_info;
							}

						}
					},
					fail(e) {
						uni.showToast({
							icon: 'none',
							title: '服务器开小差去啦~'
						});
					}
				});
			},
			//回访记录
			getRecord(e) {
				let that = this;
				sun.request({
					url: '/h5/customer.visit/detailList',
					showLoading: true,
					token: true,
					data: {
						allocate_id: e.id
						// page:that.recordPage?that.recordPage:0
					},
					success(res) {
						if (res.code == 200) {
							// that.recordData=that.recordData.concat(res.data)
							that.recordData = res.data;
						}
					},
					fail(e) {
						uni.showToast({
							icon: 'none',
							title: '服务器开小差去啦~'
						});
					}
				});
			},
			//进店记录
			shopRecord(e) {
				let that = this;
				sun.request({
					url: '/h5/customer.enter/index',
					showLoading: true,
					token: true,
					data: {
						id: e.id,
						page: that.shopPage ? that.shopPage : 0
					},
					success(res) {
						if (res.code == 200) {
							that.shopData = res.data.list;
						}
					},
					fail(e) {
						uni.showToast({
							icon: 'none',
							title: '服务器开小差去啦~'
						});
					}
				});
			},
			//编辑进店记录
			gotoShop(id) {
				uni.navigateTo({
					url: '/pages/customer/store/edit?id=' + id
				});
			},
			//时间选择
			bindTimeChange(e) {
				this.date = e.key;
			},
			//时间选择
			btnCancel() {},
			//选择门店
			holetDataFn(e) {
				this.holetData.value = e.detail.value;
				this.hotelName({
					title: this.holetData.value
				});
			},
			//进店记录
			hotelName(e) {
				let that = this;
				sun.request({
					url: '/h5/dictionary.hotel/index',
					// showLoading: true,
					token: true,
					data: {
						title: e.title
					},
					success(res) {
						if (res.code == 200) {
							that.holetList = res.data.hotelList;
						}
					},
					fail(e) {
						uni.showToast({
							icon: 'none',
							title: '服务器开小差去啦~'
						});
					}
				});
			},

			deleteHotel() {
				this.holetData.value = '';
				this.holetData.id = '';
				this.holetData = {};
			},
			cancel() {
				this.showToshop = false;
			},

		}
	};
</script>

<style lang="less" scoped>
	@import "../audit/common.less";

	// 为不影响公共样式
	page {
		padding-top: 0 !important;
		padding-bottom: 120upx;
	}

	/deep/.uni-popup.wechatUserPopup .uni-popup__wrapper {
		width: 100% !important;
		height: 100% !important;
	}


	/deep/ .uni-table {
		min-width: 100% !important;
		width: 100% !important;
	}

	.dialog-wechat {
		position: relative;
		margin: 0 auto;
		text-align: center;
		background-color: #ffffff;
		box-sizing: border-box;
	}

	.dialog-wrapper {
		margin: 0;
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;
		overflow: auto;
		z-index: 993;
		background-color: rgba(0, 0, 0, 0.5);

		.dialog {
			position: relative;
			margin: 0 auto;
			margin-top: 15vh;
			width: 90%;
			text-align: center;
			background-color: #ffffff;
			box-sizing: border-box;
		}

		.dialog-wechat {
			position: relative;
			margin: 0 auto;
			margin-top: 15vh;
			width: 90%;
			text-align: center;
			background-color: #ffffff;
			box-sizing: border-box;
		}
	}

	.nav {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		z-index: 999;
	}

	.mb12 {
		margin: 6px 0;
	}

	.custom-title {
		margin-right: 4px;
		vertical-align: middle;
	}

	page {
		background: rgba(245, 246, 246, 1);
		// padding-top: 190upx;
		padding-bottom: 160upx;
	}

	.ml12 {
		margin-left: 12px;
	}

	.icon {
		position: absolute;
		right: 2%;
		top: 50%;
		transform: translateY(-50%);
	}

	.lookup,
	.qiye-code {
		color: #1989fa;
		text-decoration: underline;
	}

	.qiye-code {
		padding-left: 25px;
	}

	.pd10 {
		padding: 10px;
		box-sizing: content-box;
		padding-right: 0;
	}

	///当下得样式
	.main_box {
		width: 100%;
		padding-top: 50px;
		box-sizing: border-box;

		.edit_text {
			// border-top:1upx solid rgba(226,226,226,1);
			height: 90upx;
			line-height: 90upx;
			// margin-top: 50upx;
			text-align: center;
			font-size: 26upx;
			font-family: PingFang SC;
			font-weight: 500;
			color: rgba(103, 103, 103, 1);
			background: #ffffff;
		}
	}

	.list_mian:first-child {
		margin-top: 0upx;
	}

	.list_mian {
		width: 100%;
		margin-top: 16upx;

		.top_text {
			width: 100%;
			display: flex;
			justify-content: left;

			.text_left {
				text:first-child {
					font-size: 26upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(25, 25, 25, 1);
				}

				text:last-child {
					font-size: 26upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(25, 25, 25, 1);
				}
			}

			.text_right {
				padding-left: 150upx;

				text:first-child {
					font-size: 26upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(25, 25, 25, 1);
				}

				text:last-child {
					font-size: 26upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(25, 25, 25, 1);
				}
			}
		}

		.edit_text {
			border-top: 1upx solid rgba(226, 226, 226, 1);
			height: 70upx;
			line-height: 90upx;
			margin-top: 50upx;
			text-align: center;
			font-size: 26upx;
			font-family: PingFang SC;
			font-weight: 500;
			color: rgba(103, 103, 103, 1);
		}
	}

	.menu {
		width: 100%;
		height: 149upx;
		padding: 29upx 0upx;
		box-sizing: border-box;
		background: #ffffff;
		position: fixed;
		bottom: 0;
		left: 0;
		display: flex;
		justify-content: space-around;

		.viewList {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			align-items: center;

			.viewList_text {
				font-size: 22upx;
				font-family: PingFang SC;
				font-weight: 500;
				color: rgba(25, 25, 25, 1);
			}

			.viewList_image {
				width: 48upx;
				height: 48upx;
				// background:rgba(245,246,246,1);
			}
		}

		.box_bottom:after {
			content: "";
			width: 0;
			height: 0;
			border: 7px solid transparent;
			border-top-color: rgba(0, 0, 0, 0.65);
			position: absolute;
			right: 34px;
			bottom: -14px;
		}

		.box_bottom {
			width: 321upx;
			// padding: 30upx;
			display: flex;
			flex-direction: column;
			justify-content: space-evenly;
			background-color: rgba(76, 76, 76, 1);
			position: absolute;
			bottom: 160upx;
			right: 30upx;
			border-radius: 12upx;

			// background-color: #FFFFFF;
			.box_bottom_text {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 10upx 0;
				border-radius: 10upx;

				// width: 200upx;
				.box_bottom_name {
					font-size: 32upx;
					text-align: left;
					width: 204upx;
					padding: 20upx 0;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: rgba(255, 255, 255, 1);
					line-height: 45upx;
					letter-spacing: 2upx;
					border-bottom: 1upx solid rgba(236, 236, 236, 0.2);
					border-radius: 3upx;
				}

				.box_bottom_icon {
					margin-left: 54upx;
					width: 41upx;
					height: 41upx;
				}
			}
		}
	}

	.dialog-wechat {
		position: relative;
		margin: 0 auto;
		text-align: center;
		background-color: #ffffff;
		box-sizing: border-box;
		border-radius: 20px;
		width: 98%;

		.toshop_title {
			width: 100%;
			padding: 15px 0;
			box-sizing: border-box;
			text-align: center;
			color: rgba(25, 25, 25, 1);
			font-size: 16px;
			background-color: #fbfbfb;

			border-top-left-radius: 10px;
			border-top-right-radius: 10px;
			position: relative;

			.closed-icon {
				position: absolute;
				left: 10px;
				top: 12px;
			}

		}

		.toshop_form {
			padding-top: 20px;
			padding-bottom: 0;
		}

		.center_bottom {
			width: 100%;
			height: 99upx;
			display: flex;
			justify-content: space-evenly;
			align-items: center;
			margin-bottom: 20px;

			text:first-child {
				width: 194rpx;
				height: 54rpx;
				border: 1rpx solid rgba(64, 108, 235, 1);
				border-radius: 27rpx;
				text-align: center;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: rgba(64, 108, 235, 1);
				line-height: 54upx;
			}

			text:last-child {
				width: 194rpx;
				height: 54rpx;
				border: 1rpx solid rgba(64, 108, 235, 1);
				border-radius: 27rpx;
				text-align: center;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #ffffff;
				line-height: 54upx;
				background: rgba(64, 108, 235, 1);
			}
		}
	}

	.control {
		margin-top: 10upx;
		padding-top: 10upx;
		width: 100%;
		height: 80upx;
		background: rgba(255, 255, 255, 1);
	}

	//门店列表弹框
	.shop_list:after {
		content: "";
		width: 0;
		height: 0;
		border: 7px solid transparent;
		border-bottom-color: #f4f4f4;
		position: absolute;
		left: 10px;
		top: -14px;
	}

	.shop_list {
		max-height: 400upx;
		padding: 20upx;
		position: absolute;
		left: 83px;
		top: 119px;
		background: #f4f4f4;
		border-radius: 10upx;

		.shop_mian {
			max-height: 200upx;
			width: 100%;
			font-size: 28upx;

			.shop_title {
				padding: 10upx 0;
				border-bottom: 1upx solid #cccccc;
			}
		}
	}

	.van-popup--center {
		width: 92%;
		border-radius: 10px;
	}

	.steps {
		padding: 10px;
		background-color: white;
		margin: 6px 0;
	}

	.step-item {
		position: relative;
		background-color: white;
		overflow: hidden;

		.step-left {
			font-size: 14px;
			padding-right: 20px;
			text-align: right;
			float: left;
			width: 40%;

			&:first-child {
				color: #969799;
			}
		}

		.step-content {
			float: left;
			border-left: solid #3c9cff 1px;
			position: relative;
			padding-left: 20px;
			padding-bottom: 30px;
			width: 50%;
			box-sizing: border-box;

			.step-dot {
				position: absolute;
				width: 10px;
				height: 10px;
				border-radius: 50%;
				background-color: #3c9cff;
				left: -6px;
				top: 0;

			}

			.record-divst {
				.record-header {
					font-size: 14px;
					font-weight: 500;
					color: rgba(0, 0, 0, 0.85);
					line-height: 22px;
				}

				.record-div {
					overflow: hidden;
					font-size: 14px;
					font-weight: 400;
					line-height: 25px;

					.record-title {
						float: left;
						margin-right: 8px;
						font-size: 14px;
						font-weight: 400;
						line-height: 22px;
					}

					.uniui-sound {
						vertical-align: -4px;
					}

					.record-name {
						float: left;
					}

					.record-style {
						width: 20px;
						height: 20px;
					}
				}
			}
		}


	}





	.step-title {
		font-weight: bold;
		font-size: 18px;
	}

	.step-desc {
		font-size: 16px;
		padding-top: 4px;
		color: #999;
	}

	.step-line {
		position: absolute;
		top: 10px;
		/* 根据圆点的尺寸调整 */
		left: 1%;
		/* 将竖线居中对齐 */
		bottom: -20px;
		/* 调整竖线的长度 */
		width: 1px;
		background-color: #3c9cff;
	}

	// /deep/.van-tab__pane {
	// 	height: calc(100vh - 580px);
	// 	overflow: auto;
	// }
	.info {
		display: flex;
		padding: 8px 12px;
		flex-wrap: wrap;
		border-bottom: 1upx solid #eeeeee;

		.con {
			width: 50%;
			height: 45upx;
			line-height: 45upx;
			display: flex;
			align-items: center;

			.txt1 {
				position: relative;
				flex: 0 4rem;
				font-size: 28upx;
				color: #666666;
			}

			.wtxt {
				flex: 0 103px;
				position: relative;
				font-size: 28upx;
				color: #666666;
			}

			.txt1::after {
				position: absolute;
				content: ":";
				right: 8px;
			}

			.txt2 {
				flex: 1;
				font-size: 28upx;
				color: #666666;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}

			.wtxt2 {
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
		}
	}

	.table_box {
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
		font-size: 13px;
		margin: 0 2px;

		.row_th {
			flex: 1;
		}

		.row-td {
			flex: 1;
			border-bottom: #f2eaea solid 1px;
			line-height: 30px;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
			text-align: center;
		}
	}

	.table_hd {
		border-bottom: #ddd solid 1px;
		line-height: 30px;
		text-align: center;
	}
</style>
